//index.js
Page({
  data: {
    background:[],
    indicatorDots:true, 
    autoplay:true,
    circular:true,
    vertical:false,
    interval:3000,
    duration:500
  },
  changeIndicatorDots(e){
    this.setData({
      indicatorDots:!this.data.indicatorDots
    })
  },
  changeAutoplay(e){
    this.setData({
      autoplay:!this.data.autoplay
    })
  },
  changeCircular(e){
    this.setData({
      circular:!this.data.circular
    })
  },
  changeVertical(e){
    this.setData({
      vertical:!this.data.vertical
    })
  },
  colorChange(){
    var bg=[];
    for(var i=0;i<3;i++){
      var color="rgb(";
      for(var j=0;j<3;j++){
        var x=parseInt(Math.random()*256);
        color+=x+",";
      }
      color=color.substring(0,color.length-1)+")";
      bg.push(color);
    }
    this.setData({
      background:bg
    });
    console.log(this.data.background);
  },
  onLoad:function(){
    var bg=[];
    for(var i=0;i<3;i++){
      var color="rgb(";
      for(var j=0;j<3;j++){
        var x=parseInt(Math.random()*256);
        color+=x+",";
      }
      color=color.substring(0,color.length-1)+")";
      bg.push(color);
    }
    this.setData({
      background:bg
    });
    console.log(this.data.background);
  }
})
